@import("js.annot");

const slime_member_sources   = {};

const registerSourceFunctors = function(kitty, field, functor){
    
    if (@.is(functor,Function) && @options("sources") && @options("sources")[kitty.name]){
        
        if (!slime_member_sources[kitty.name]) {
            slime_member_sources[kitty.name] = {
                owner : @options("sources")[kitty.name]
            };
        }

        slime_member_sources[kitty.name][field] = functor;
    }
}

@annot.func("mewchan.kitty", "slime.source.detector", function(functor) {
    registerSourceFunctors(@kitty(this.file),"detector",functor);
});

module.exports = slime_member_sources;